import mysql.connector

try:
    # 连接数据库
    conn = mysql.connector.connect(
        host='localhost',
        user='root',
        password='1472580369',
        database='medical_literature_system'
    )

    cursor = conn.cursor()

    # 查询用户信息
    cursor.execute("SELECT id, username, password, email, phone FROM sys_user WHERE username = 'admin'")
    results = cursor.fetchall()

    print("管理员用户信息:")
    for row in results:
        print(f"ID: {row[0]}, 用户名: {row[1]}, 密码: {row[2]}, 邮箱: {row[3]}, 电话: {row[4]}")

    cursor.close()
    conn.close()
    
except mysql.connector.Error as err:
    print(f"数据库连接错误: {err}")
except Exception as e:
    print(f"其他错误: {e}")